package com.tanxi521.springboot.service.impl;

import com.tanxi521.springboot.mapper.OfficialMessageMapper;
import com.tanxi521.springboot.pojo.OfficialMessage;
import com.tanxi521.springboot.pojo.Page;
import com.tanxi521.springboot.service.InGameMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Author: i-xiaotian
 * @Date: 2022/4/10 15:47
 * @EMAIL: 1254806967@qq.com
 */
@Service
public class InGameMessageServiceImpl implements InGameMessageService {

    @Autowired
    OfficialMessageMapper officialMessageMapper;

    @Override
    public List<OfficialMessage> queryOfficialMessage(Integer pageSize, Integer pageIndex) {
        Page page = new Page(pageIndex, pageSize);
        return officialMessageMapper.selectOfficialMessage(page);
    }

    @Override
    public int queryMessageCount() {
        return officialMessageMapper.selectMessageCount();
    }

    @Override
    public int insertOfficialMessage(String createBy, String message) {
        OfficialMessage officialMessage = new OfficialMessage();
        officialMessage.setCreateBy(createBy);
        officialMessage.setTnVexMessage(message);
        officialMessage.setCreateTime(new Date());
        return officialMessageMapper.insert(officialMessage);
    }

    @Override
    public int deleteOfficialMessage(List<Integer> ids) {
        return officialMessageMapper.deleteOfficialMessage(ids);
    }
}
